Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing a block normally #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

jgaskins
Copy link

In addition to passing a Proc as a value, this PR allows us to pass a first-class block to Crambda.run_handler:

Crambda.run_handler do |event, context|
  { foo: "bar", omg: "lol", wtf: 42 }
end

Notice that we don't even need to return a JSON::Any explicitly — we can pass anything that responds to to_json.

In addition to passing a `Proc` as a value, this commit allows us to
pass a first-class block to `Crambda.run_handler`:

    Crambda.run_handler do |event, context|
      { foo: "bar", omg: "lol", wtf: 42 }
    end
@mhart
Copy link
Member

mhart commented Dec 24, 2018

This is great! I removed the block signature back in a4dbb0f#diff-04c6e90faac2675aa89e2176d2eec7d8L27 –  but I should've kept both.

Can you update the documentation so that it mentions both forms? The existing form matches AWS' Ruby runtime, which I think is still worth pointing out.

@ErikAGriffin
Copy link

Is this project still live?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants